home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1990-06-14 | 4.6 KB | 114 lines | [TEXT/PMED] |
- (*************************************)
- (**) DEFINITION MODULE fxWindows;(**)
- (*************************************)
- (* Franz Kronseder / ETHZ / 04.08.85 *)
-
- (* This module intends to provide a window administration object (data type) *)
- (* that applies standard methods for event parsing, window dragging,sizing, *)
- (* activation/deactivation, updating, and dispatches to user supplied *)
- (* "EventHandling methods" *)
-
- IMPORT WindowMgr,QuickDraw;
- FROM SYSTEM IMPORT ADDRESS;
- FROM MacBase IMPORT StrPtr,LongInt;
- FROM QuickDraw IMPORT Rect;
- FROM EventMgr IMPORT EventRecord;
-
- EXPORT QUALIFIED
- DocumentProc,DBoxProc,NoShadowDBox,RDocProc,
- altDBoxProc,noGrowDocProc,
- WexistsId,
- WindowPtr,GrafPtr ,wDefPtr,wProcPtr,
- EventHandler,wDefRec,wProcRec,
- allocateWindow,deallocateWindow,
- defaultSetup,defaultMethods,
- resetfxWindows,PaintScreenGray;
-
- CONST (* window definition procedure IDs *)
- DocumentProc = WindowMgr.DocumentProc; (* standard document window *)
- DBoxProc = WindowMgr.DBoxProc; (* alertbox or modal dialog box *)
- NoShadowDBox = WindowMgr.NoShadowDBox;
- RDocProc = WindowMgr.RDocProc; (* rounded corner window *)
- altDBoxProc = 3; (* dBoxProc with shadow instead of border *)
- noGrowDocProc=4; (* document window without size box *)
-
- CONST WexistsId = 0FFFFh; (* special resource ID for allocateWindow *)
- (* for creating a window task with an already *)
- (* existing window. e.g. a Dialog-Window *)
-
- TYPE WindowPtr = WindowMgr.WindowPtr;
- GrafPtr = QuickDraw.GrafPtr;
- wDefPtr = POINTER TO wDefRec;
- wProcPtr = POINTER TO wProcRec;
- EventHandler = PROCEDURE (VAR EventRecord):BOOLEAN;
-
- wDefRec = RECORD
- WindowID : INTEGER; (* resource ID *)
- wStorage : ADDRESS; (* Ptr to Window Record *)
- boundsRect: Rect; (* for its GrafPort *)
- title : StrPtr; (* a Pascal String *)
- visible : BOOLEAN;
- procID : INTEGER;
- behind : WindowPtr;
- goAwayFlag: BOOLEAN;
- refCon : LongInt; (* user data stored with the window *)
- END;(* wDefRec *)
- (* for window creation: *)
- (* if WindowID = 0 WindowMgr.NewWindow is used together *)
- (* with the rest of the record. Otherwise it will be *)
- (* argument to WindowMgr.GetNewWindow for reading in a *)
- (* Window template with that WindowID from resource file *)
-
-
- wProcRec =
- RECORD
- activateProc : EventHandler;
- updateProc : EventHandler;
- ContentProc : EventHandler;
- GoAwayProc : EventHandler;
- GrowProc : EventHandler;
- CleanupProc : EventHandler; (* will be called before the Window *)
- (* is closed *)
- END; (* of wProcRec *)
- (* Each window in the WindowStack has an associated record of *)
- (* of method procedures. for mouseDown, activateEvt and *)
- (* updateEvt WindowStack dispatches to one of these methods *)
- (* depending on the WindowMgr.FindWindow result code. *)
-
- PROCEDURE allocateWindow (VAR theWindow :WindowPtr;
- theSetup : wDefPtr;
- theMethods: wProcPtr);
- (* create a new window and process the subsequent events for it. *)
- (* theSetup points to a form containing the creation parameters. *)
- (* theMethods points to a collection of procedure variables that *)
- (* will be called as associated events occor in the window. *)
- (* theSetup=NIL will create some default window *)
- (* for NIL procedure variables default methods will be used *)
-
- PROCEDURE deallocateWindow(VAR theWindow:WindowPtr);
- (* if theWindow = NIL then return return a pointer to fxWindows *)
- (* internal default wDefRec else copy it to the users variable *)
- (* stop processing the events for theWindow and dispose its *)
- (* WindowRecord *)
-
- PROCEDURE defaultSetup (VAR theSetup :wDefPtr);
- (* if theSetup= NIL then return return a pointer to fxWindows *)
- (* internal default wDefRec *)
- (* else copy the content of the default wDefRec to theSetup^ *)
-
- PROCEDURE defaultMethods(VAR theMethods:wProcPtr);
- (*if theMethods is NIL then return a pointer to the internal *)
- (* default wProcRec otherwise copy the internal defaults *)
- (* to theMethods^. This allows the user to selectively *)
- (* overwrite the defaults *)
-
- PROCEDURE resetfxWindows;
- (* dispose all currently active Windows and bring the Module *)
- (* fxWindows into its initial State *)
-
- PROCEDURE PaintScreenGray;
- (* fills the portrect of the WindowMgrPort with the gray Pattern *)
- (* of the QuckDraw globals *)
-
- END fxWindows.
-